import request from '@/utils/request'

/** ****************************视频管理*******************************************/

// 视频列表
export function getVideoList(data) {
  return request({
    url: '/v1/video?current=' + data.current + '&size=' + data.size,
    method: 'GET'
  })
}

// 根据视频ID查询视频信息
export function getVideoById(data) {
  return request({
    url: '/v1/video?id=' + data,
    method: 'GET'
  })
}

// 搜索视频
export function searchVideoList(data) {
  return request({
    url: '/v1/video?current=' + data.current + '&size=' + data.size + '&title=' + data.title + '&newsSource=' + data.newsSource,
    method: 'GET'
  })
}

// 添加视频
export function addVideo(data) {
  return request({
    url: '/v1/video',
    method: 'POST',
    data: data
  })
}

// 修改视频
export function updateVideo(data) {
  return request({
    url: '/v1/video',
    method: 'PUT',
    data: data
  })
}

// 删除视频
export function deleteVideo(data) {
  return request({
    url: '/v1/video?ids=' + data,
    method: 'DELETE'
  })
}

// 热推视频
export function hostVideo(data) {
  return request({
    url: '/v1/video',
    method: 'PUT',
    data: data
  })
}

// 置顶视频
export function topVideo(data) {
  return request({
    url: '/v1/video',
    method: 'PUT',
    data: data
  })
}

// 修改评论
export function updateComment(data) {
  return request({
    url: '/v1/videoComment',
    method: 'PUT',
    data: data
  })
}

// 根据id查询评论
export function getCommentById(data) {
  return request({
    url: '/v1/videoComment?id=' + data.id,
    method: 'GET'
  })
}

// 视频分类列表
export function getVideoTypeList(data) {
  return request({
    url: '/v1/videoCat?current=' + data.current + '&size=' + data.size,
    method: 'GET'
  })
}

// 视频分类添加
export function addVideoType(data) {
  return request({
    url: '/v1/videoCat',
    method: 'POST',
    data: data
  })
}

// 视频分类修改
export function updateVideoType(data) {
  return request({
    url: '/v1/videoCat',
    method: 'PUT',
    data: data
  })
}

// 视频分类详情
export function getVideoTypeDetail(data) {
  return request({
    url: '/v1/videoCat?id=' + data.id,
    method: 'GET'
  })
}

// 视频分类删除
export function deleteVideoType(data) {
  return request({
    url: '/v1/videoCat?ids=' + data,
    method: 'DELETE'
  })
}

// 根据视频ID查询视频评论
export function getVideoCommentById(data) {
  return request({
    url: '/v1/videoComment?videoId=' + data.id + '&current=' + data.current + '&size=' + data.size + '&pid=0',
    method: 'GET'
  })
}

// 查询视频评论列表
export function getVideoComment(data) {
  return request({
    url: '/v1/videoComment',
    method: 'GET',
    data: data
  })
}

// 修改视频评论
export function updateVideoComment(data) {
  return request({
    url: '/v1/videoComment',
    method: 'PUT',
    data: data
  })
}

// 删除视频评论
export function deleteVideoComment(data) {
  return request({
    url: '/v1/videoComment?ids=' + data,
    method: 'DELETE'
  })
}

// 根据一级评论ID查询二级评论
export function getSecondCommentById(data) {
  return request({
    url: '/v1/videoComment?pid=' + data.pid,
    method: 'GET'
  })
}

// 隐藏评论
export function hideVideoComment(data) {
  return request({
    url: '/v1/videoComment',
    method: 'PUT',
    data: data
  })
}

// 查询视频同步关系表列表
export function getSyncVideo(data) {
  return request({
    url: '/v1/syncVideo?current=' + data.current + '&size=' + data.size,
    method: 'GET'

  })
}

// 保存syncVideo
export function addSyncVideo(data) {
  return request({
    url: '/v1/syncVideo',
    method: 'POST',
    data: data
  })
}

// 修改视频同步关系
export function updateSyncVideo(data) {
  return request({
    url: '/v1/syncVideo',
    method: 'PUT',
    data: data
  })
}

// 删除视频同步关系
export function deleteSyncVideo(data) {
  return request({
    url: '/v1/syncVideo/delete',
    method: 'POST',
    data: data
  })
}

// 查询视频同步关系
export function getSyncVideoById(data) {
  return request({
    url: '/v1/syncVideo?id=' + data.id,
    method: 'GET'
  })
}

// 视频同步到商家
export function getSyncSeller(data) {
  return request({
    url: '/v1/syncVideo/syncSeller/' + data.id + '?type=' + data.type + '&current=1' + '&size=9999',
    method: 'POST',
    data: data
  })
}
